package com.example.multithreading;



public class ch03_01 {
    public static void main(String[] args) throws InterruptedException {
        new Thread(()->{
            long startTime = System.currentTimeMillis();
            sleep(2000L);
            long endTime = System.currentTimeMillis();
            System.out.println(String.format("1花费的时间 %d ms",(endTime-startTime)));
        }).start();

        long startTime1 = System.currentTimeMillis();
        Thread.sleep(3000l);
        long endTime1 = System.currentTimeMillis();
        System.out.println(String.format("2花费的时间 %d ms",(endTime1-startTime1)));
    }

    private static void sleep(long time){

        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

    }


}
